﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Web;

public partial class Admin_UserManagement_UserContent : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["userid"] != null)
            {
                string userid = Session["userid"].ToString();

                string sql = "select * from users where userid = " + userid;
                DataTable table = DBHelper.GetDataSet(sql);
                if (table.Rows.Count > 0)
                {
                    Label6.Text = table.Rows[0]["userlogin"].ToString();
                    Label7.Text = table.Rows[0]["UserName"].ToString();
                    Label8.Text = table.Rows[0]["UserSex"].ToString();
                    Label9.Text = table.Rows[0]["Department"].ToString();
                    Label10.Text = table.Rows[0]["CostCenters"].ToString();
                    Label11.Text = table.Rows[0]["UserIDCard"].ToString();
                    Label12.Text = table.Rows[0]["UserAge"].ToString();
                    Label13.Text = table.Rows[0]["Marriage"].ToString();
                    Label14.Text = table.Rows[0]["HandsetNumber"].ToString();
                    Label15.Text = table.Rows[0]["TelephoneNumber"].ToString();
                    Label16.Text = table.Rows[0]["UserAddress"].ToString();
                    Label17.Text = table.Rows[0]["UserEmail"].ToString();
                    Label18.Text = table.Rows[0]["Area"].ToString();
                    Label19.Text = table.Rows[0]["language"].ToString();
                }

                string sql1 = "select * from MedicalAppointment where UserID ='" + userid + "'";
                DataTable table1 = DBHelper.GetDataSet(sql1);
                if (table1.Rows.Count > 0) //有预约体检
                {
                    DateTime time = DateTime.Parse(table1.Rows[0]["ReservationTime"].ToString());
                    Label1.Text = time.ToString("yyyy-MM-dd");
                    Label2.Text = table1.Rows[0]["SetMeal"].ToString();
                    Label3.Text = table1.Rows[0]["AgencyName"].ToString();
                    Label4.Text = table1.Rows[0]["AgencyAddress"].ToString();
                    string BookingStatus = table1.Rows[0]["BookingStatus"].ToString();
                    if (BookingStatus.Equals("0"))
                    {
                        Label5.Text = "已预约";
                    }
                    else if (BookingStatus.Equals("1"))
                    {
                        Label5.Text = "已取消";
                    }
                    else
                    {
                        Label5.Text = "已体检";
                    }
                }
                else 
                {
                    Label5.Text = "未预约";
                }
            }
        }
    }
    protected void btnEbit_Click(object sender, EventArgs e)
    {
        Response.Redirect("userEdit.aspx");
    }
}
